<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('咨询列表')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="type-form">
                <div class="select-list">
                    <ul>
                        <li>
                            企业名称：<input type="text" name="name"/>
                        </li>
                        <li>
                            审核状态：<select name="reviewStatus">
                            <option value="">所有</option>
                            <option value="0">待审核</option>
                            <option value="1">审核通过</option>
                            <option value="2">审核不通过</option>
                        </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

       <!-- <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.addnoticFull()" shiro:hasPermission="system:business:add">
                <i class="fa fa-plus"></i> 添加信息
            </a>
        </div>-->

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript">
    var prefix = ctx + "system/member";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/detail/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            detailUrl: prefix + "/detail/{id}",
            sortName: "createTime",
            sortOrder: "desc",
            modalName: "咨询管理",
            columns: [
            {
                field: 'id',
                title: '序号'
            },
            {
                field: 'name',
                title: '企业名称',
                sortable: false
            },
            {
                field: 'linkName',
                title: '联系人',
                sortable: false
            },
            {
                field: 'linkPhone',
                title: '联系人手机号码'
            },
            {
                field: 'reviewStatus',
                title: '审核状态',
                formatter: function (value, row, index) {
                                        return statusTools(row);
                                 }
            },
            {
                field: 'enterTime',
                title: '上报时间',
                sortable: false
            },
            {
                title: '操作',
                align: 'center',
                formatter: function(value, row, index) {
                    var actions = [];
                    actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" data-id="'+row.id+'" onclick="auditRecord(\'' + row.id + '\')"><i class="fa fa-times"></i>审核记录</a> ');
                    if(row.reviewStatus == '0'){
                       actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="details(\'' + row.id + '\')"><i class="fa fa-edit"></i>审核</a> ');
                    }
                    return actions.join('');
                }
            }]
        };
        $.table.init(options);
    });

    /*字典列表-详细*/
    function detail(id) {
        var url = prefix + '/detail/' + id;
        $.modal.openTab("标签数据", url);
    }

    function statusTools(row) {
		    if (row.reviewStatus == 0) {
    			return '待审核';
    		} else if(row.reviewStatus == 1){
    			return '审核通过';
    		}else {
    		    return '审核不通过';
    		}
		}

    function updateStatus(data){
        $.operate.get(prefix + "/status?id=" + data);
    }

    function details(data){
        $.modal.openFull("认证审核",prefix + "/audit/detail/" + data);
    }

    function auditRecord(id){
        $.modal.open("审核记录",prefix + "/audit/" + id);
    }
</script>
</body>
</html>